package com.idanchuang.component.shadow.route.common.dynamic;

import com.idanchuang.component.shadow.route.common.context.ShadowRouteContext;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

/**
 * Shadow Routing Dynamic Data Source
 * 1.only supports singleton db with table sharding
 * 2.only supports local transaction with spring
 *
 * @author Raistlin
 */
public class ShadowRoutingDataSource extends AbstractRoutingDataSource {

    @Override
    protected Object determineCurrentLookupKey() {
        return ShadowRouteContext.getRoutingKey();
    }

}
